namespace AutomaticLogin
{
    using System;
    using System.Xml.Serialization;
    using System.Xml;
    using System.Collections.Generic;
    using System.Text;


    public partial class LoginInputs
    {
        private Dictionary<string, LoginInput> m_List = new Dictionary<string, LoginInput>();

        public LoginInputs() { }
        public LoginInputs(XmlNode node) 
        {
            foreach (XmlNode child in node.ChildNodes)
            {
                LoginInput input = new LoginInput(child);
                m_List[input.inputId] = input;
            }            
        }

        public string this[string key]
        {
            get
            {
                if (!m_List.ContainsKey(key)) return null;
                return m_List[key].val;
            }
            set
            {
                LoginInput newInput = new LoginInput();
                newInput.inputId = key;
                newInput.val = value;
                m_List[key] = newInput;
            }
        }

        public string ToXml()
        {
            StringBuilder sb = new StringBuilder();
            foreach (LoginInput li in m_List.Values)
            {
                sb.AppendLine(li.ToXml());
            }
           return sb.ToString();
        }
    }
}
